let vm=new Vue({
    el:'#main',
    data:{
        result:{},
        map:{}
    },
    methods:{
        selectPage:function (pageNum, pageSize) {
            axios({
                url:`fee/selectPage/${pageNum}/${pageSize}`,
                method:'post',
                data: this.map
            }).then(rs=>{
                this.result=rs.data.obj
            })
        },
        descTwo:function () {
            this.map={};
            this.map.baseCost=1;
            this.selectPage(1,5);
        },
        descThree:function () {
            this.map={};
            this.map.baseDuration=1;
            this.selectPage(1,5);
        },
        toUpdate:function (fee) {
            layer.fee=fee;
            layer.message=0;
            layer.open({
                type:2,
                title:false,
                area:['80%','80%'],
                content:'fee/toUpdate',
                end:()=>{
                    if (layer.message > 0) {
                        layer.msg("更新成功");
                        this.map={};
                        this.selectPage(1,5)
                    }else if (layer.message<0) {
                        layer.msg("更新失败")
                    }
                }
            })
        },
        detail:function (fee) {
            layer.fee=fee;
            layer.message=0;
            layer.open({
                type:2,
                title:false,
                area:['80%','80%'],
                content:'fee/detail',
                end:()=>{
                }
            })
        },
        deleteOne:function (fee) {
            axios({
                url: 'fee/deleteOne',
                method: 'post',
                data:{"fee":fee}
            }).then(rs=>{
                if (rs.data.success) {
                    layer.msg("删除成功");
                    this.map={};
                    this.selectPage(1,5)
                }else {
                    layer.msg("删除失败")
                }
            })
        },
        insert:function () {
            layer.message=0;
            layer.open({
                type:2,
                title:false,
                area:['80%','80%'],
                content:'fee/insertCost',
                end:()=>{
                    if (layer.message > 0) {
                        layer.msg("添加成功");
                        this.map={};
                        this.selectPage(1,5)
                    }else if (layer.message<0) {
                        layer.msg("添加失败")
                    }
                }
            })
        }
    },
    created:function () {
        this.selectPage(1,5)
    }
})